﻿// Copyright 2007-2008 Rory Plaire (codekaizen@gmail.com)

using System;

namespace NPack.Interfaces
{
    /// <summary>
    /// Defines a type which can be operated on by exponential operations.
    /// </summary>
    /// <typeparam name="T">Type on which exponentiation is defined.</typeparam>
    public interface IExponential<T>
    {
        /// <summary>
        /// Returns a value which is the called on value raised to the given <paramref name="exponent"/>.
        /// </summary>
        /// <param name="exponent">The power to raise the value by.</param>
        /// <value>x ^ <c>exponent</c></value>
        /// <returns>The value called on raised to the power given.</returns>
        T Power(Double exponent);

        /// <summary>
        /// Returns a value which is the square root of the value called on.
        /// </summary>
        /// <value>x ^ 0.5</value>
        /// <returns>The value called on raised to the power of 0.5.</returns>
        T Sqrt();

        /// <summary>
        /// Returns a value which is the natural log of the called-on value given the new base.
        /// </summary>
        /// <param name="newBase">New base to find what the called-on value is the exponent of.</param>
        /// <value>ln <c>value</c> / ln <c>newBase</c></value>
        /// <returns>The log</returns>
        T Log(Double newBase);

        /// <summary>
        /// Returns a value which is the natural log of the called-on value.
        /// </summary>
        /// <value>ln <c>value</c></value>
        /// <returns>The natural log of the given value.</returns>
        T Log();

        /// <summary>
        /// Returns <c>e</c> raised to the power of the called on value.
        /// </summary>
        /// <value>e ^ <c>value</c></value>
        /// <returns>The value of the natural log base, e, raised to the power of the called on value.</returns>
        T Exp();
    }
}
